<% include '/WEB-INF/includes/header.gtpl' %>

<div align="center">

	<%
		request.blogs.each { blog -> 
	%>
	<table border="1">
	<tr>
	<table bgcolor="skyblue" width="900px">
	<tr>
	<td><a href="/article/${blog.title}">${blog.title}</a></td>
	</tr>
	<tr>
	<td><%= blog.content.length() > 120 ? blog.content.substring(0,119)+"..."+"<a href='/article/${blog.title}'>阅读全部</a>" : blog.content %></td>
	</tr>
	<tr>
	<td><h4>发布于:${blog.pubTime}</h4></td>
	</tr>
	</table>
	</tr>
	<table>
	
	<%
		}
		
	def page = request.page as Integer
	%>
	<div align="left">
	<%
		if(request.blogs.size() == 5){
	%>
	<%= page == 1 ? "<a href='/page/${page+1}'>下一页</a>" : "<a href='/page/${page-1}'>上一页</a>|<a href='/page/${page+1}'>下一页</a>" %>
	<%
		}else{
	%>
	<%= page == 1 ? "" : "<a href='/page/${page-1}'>上一页</a>" %>
	<%		
		}
	%>
	</div>
	
<a href="/addArticle.gtpl">添加文章</a>
<a href="/addUser.gtpl">添加用户</a>

</div>

<% include '/WEB-INF/includes/footer.gtpl' %>